package seunit.framework.automation;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
import java.io.*;

import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

@SuppressWarnings("unused")
/**
 * @class util
 * util.java
 * Purpose: Utilities for FrameWork
 *
 * @author Vishal Sangave
 * @version 1.0 5 June 2012
 */
public class debug {

	public static void getError(Exception e){
		System.out.println("E");
		StackTraceElement[] ste2 = e.getStackTrace();
		log.error.append("Error :"+e.getMessage()+"\n\n");
		
		for (StackTraceElement ste : ste2){
			 if (ste.toString().startsWith("library")){
				  log.error.append(ste + "\n\n");
			 }
			 if (ste.toString().startsWith("test")){
				 log.error.append(ste + "\n\n");
			 }
			 if (ste.toString().startsWith("Runner")){
				 log.error.append(ste + "\n\n");
			 }
			 if (ste.toString().startsWith("seunit")){
				 log.error.append(ste + "\n\n");
			 }
		}
	}
	
	
	public static void getFailure(Error e){
		
		StackTraceElement[] ste2 = e.getStackTrace();
		log.failure.append("Failure :"+e.getMessage()+"\n\n\n");
		
		for (StackTraceElement ste : ste2){
			 if (ste.toString().startsWith("library")){
				  log.failure.append(ste + "\n\n");
			 }
			 if (ste.toString().startsWith("test")){
				 log.failure.append(ste + "\n\n");
			 }
			 if (ste.toString().startsWith("Runner")){
				 log.failure.append(ste + "\n\n");
			 }
			 if (ste.toString().startsWith("seunit")){
				 log.failure.append(ste + "\n\n");
			 }
		}
	}
}
